package com.dys.teststring09;

/**
 * @className: com.dys.teststring09.StringTest03
 * @description: com.dys.teststring09
 * @author: pine cone
 * @version: v1.0.0
 * @createTime: 2024/07/29 下午8:27
 */
public class StringTest03 {
    /**
     * 这是一个main()方法,是应用程序的入口
     *
     * @param args 方法的形参列表,是一个字符串数组,包含了从命令行传递给程序的参数
     */
    public static void main(String[] args) {
        // 1.字符串拼接
        String s1 = "abc";
        String s2 = "a" + "b" + "c";
        String s3 = "ab" + "c";
        String s4 = "a" + "bc";
        String s5 = "abc" + "";
        System.out.println(s1 == s2);
        System.out.println(s1 == s3);

        // 2.new关键字创建对象
        String s6 = new String("abc");
        System.out.println(s6);

        // 3.有变量参与的字符串拼接
        String s7 = "abc";
        String s8 = s7 + "def";
        System.out.println(s8);
    }
}
